package com.summer.safe.system.service;

import com.summer.safe.base.BaseService;
import com.summer.safe.system.dao.DictTypeDao;
import com.summer.safe.config.result.ResultCode;
import com.summer.safe.exception.CustomException;
import com.summer.safe.system.entity.DictType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 字典类型Service
 *
 */
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class DictTypeService extends BaseService<DictTypeDao, DictType> {

    /**
     * 查询字段类型列表
     *
     * @return
     */
    public List<DictType> findTypeList() {
        return dao.findTypeList();
    }

    /**
     * 检查的字典类型是否存在
     */
    public void getCheckType(String type) {
        String result=dao.getCheckType(type);
        if(result==null){
            throw new CustomException(ResultCode.UNKNOWN_ERROR);
        }
    }








}
